<template>
    <div>
        <footer class="footer">
      <span class="todo-count"><strong>{{list.length}}</strong>剩余</span>
      <ul class="filters" @click="$emit('typeSelect',type)">
        <li>
          <a @click="type='all'" :class="{selected:type==='all'}" href="#/">全部</a>
        </li>
        <li>
          <a @click="type='active'" :class="{selected:type==='active'}" href="#/active">进行中</a>
        </li>
        <li>
          <a @click="type='completed'" :class="{selected:type==='completed'}" href="#/completed">已完成</a>
        </li>
      </ul>
      <button @click="clearAll" v-show="showTask" class="clear-completed">清除已完成</button>
    </footer>
    </div>
</template>

<script>
export default {
    data() {
        return {
            type:"all"
        };
    },
    props: {
        list:{
            type:Array,
            required:true
        }
    },
    methods: {
        clearAll(){
        
            this.$emit('clearAll');
        },
        
    },
    computed: {
        showTask(){
            return this.list.some(item=>item.isDone)
        }
    }
};
</script>

<style >

</style>